<?php
namespace config;
use lib\autoload;

/**
 * Ldy-Item-all-config
 * Class config
 * @package config
 */
class config{

    public static $config = [];

    /**
     * 自动加载 配置文件
     */
    public static function readRule(){
       autoload::itemLoad(__DIR__.DR.'config');
       autoload::itemLoad(APP.DR.VI.DR.'config');
    }

    public static function get($key,$param=''){
        $configData = self::$config[$key];
        if (empty($param)) return $configData;
        return $configData[$param];
    }

    public static function set($key,$value){
        self::$config = !empty(self::$config)?array_merge(self::$config,[$key=>$value]):self::$config=[$key=>$value];
        return self::$config;
    }

    public static function _unset($key){
        unset(self::$config[$key]);
        return self::$config;
    }
}
